import { get, post, del, patch } from "../utils/request";

// 登录
export const login = async (body) => {
  return await post('/auth/login', body)
}

// 当前用户
export const queryCurrentUser = async () => {
  return await get('/auth/queryCurrentUser')
}

// 帐号登出
export const logout = async () => {
  return await post('/auth/logout')
}

// 查询角色列表
export const queryRoleList = async () => {
  return await get('/user/roleList')
}

// 创建用户
export const createUser = async (body) => {
  return await post('/user', body)
}

// 删除用户
export const deleteUser = async (id) => {
  return await del(`/user/${id}`)
}

// 批量删除用户
export const batchDeleteUser = async (body) => {
  return await del('/user', body)
}

// 更新用户
export const updateUser = async (id, body) => {
  return await patch(`/user/${id}`, body)
}

// 查询用户
export const queryUser = async (id) => {
  return await get(`/user/${id}`)
}

// 查询用户列表
export const queryUserList = async (queryBody) => {
  return await get('/user', queryBody)
}

// 重置用户密码
export const resetPassword = async (body) => {
  return await post('/user/resetPassword', body)
}

// 用户修改密码
export const userUpdatePassword = async (body) => {
  return await post('/user/userUpdatePassword', body)
}

// 用户表勾选导出
export const userSelectExport = async (body) => {
  return await post('/user/userSelectExport', body, {
    responseType: 'blob'
  })
}

// 用户表查询导出
export const userSearchExport = async (body) => {
  return await post('/user/userSearchExport', body, {
    responseType: 'blob'
  })
}
